<extend name="work/base"/>
<block name="content">
    <div class="layui-container">
        <h1 class="site-h1">详细内容</h1>
        <table class="layui-table">
            <tbody>
            <tr >
                <td width="58px">文档名称</td>
                <td>{$info.title|default=''}</td>
            </tr>
            <tr>
                <td>文档状态</td>
                <td>{$info.doc_type|default=''}</td>
            </tr>
            <tr>
                <td>详情</td>
                <td>{$info.info|raw|default=""}</td>
            </tr>
            <tr>
                <td>附件信息</td>
                <td><notempty name="info.file_path"><a href="{$info.file_path|default=''}">点击查看</a><else/>无</notempty> </td>
            </tr>

            </tbody>
        </table>
        <notempty name="comment">
            <h1 class="site-h1">讨论内容</h1>
            <ul class="layui-timeline" >
                <volist name="comment" id="vo" key="k">
                    <li class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                        <div class="layui-timeline-content layui-text">
                            <h4 class="layui-timeline-title">{$vo.c_time}</h4>
                            <ul>
                                <li>{$vo.nickname}</li>
                            </ul>
                            <div class="doc_info">{$vo.info|raw}</div>
                    </li>
                </volist>
            </ul>


            <else/>
            <hr>
        </notempty>
        <form class="layui-form" action="">
            <div class="layui-form-item layui-form-text">
                <textarea name="info" placeholder="发表讨论内容" class="layui-textarea" rows="6"></textarea>
            </div>
            <input type="hidden" name="doc_id" value="{$info.id}">
            <input type="hidden" name="project_id" value="{$info.project_id}">

            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="formDemo">立即发表</button>
            </div>
        </form>

    </div>
</block>
<block name="script">
    <script type="text/html" id="view">
        {{d.groups_pname}}-{{d.groups_name}}
    </script>

    <script type="text/html" id="barDemo">
        <a class="layui-btn  layui-btn-xs " lay-event="forms2" forms-url2="{:url('add_check')}">评分</a>
    </script>
    <script type="text/javascript">
        layui.use(['form', 'layer', 'table'], function () {
            var form = layui.form
                , $ = layui.$
                , laypage = layui.laypage;
            var table = layui.table;
            form.on('submit(formDemo)', function (data) {
                $.ajax({
                    url: "{:url('index')}",
                    type: 'POST',
                    dataType: 'json',
                    data: data.field
                })
                    .done(function (res) {
                        if (res.code == 1) {
                            layer.msg(res.msg, {
                                time: 3000,
                                icon: 1
                            }, function () {
                                location.reload()
                            });
                        } else {
                            layer.msg(res.msg, {
                                time: 1500,
                                icon: 5
                            });
                        }
                    })
                    .fail(function () {
                        layer.msg('服务器异常', {
                            time: 1500,
                            icon: 5
                        });
                    })
                    .always(function () {

                    });
                return false;
            });
            table.render({
                elem: '#list'
                , url: "{:Url('work_lists')}"
                , page: true
                , loading: true
                , limit: 25
                , page: {
                    layout: ['prev', 'page', 'next']
                }
                , cols: [[
                    {field: 'e_time', width: 85, title: '结束时间'}
                    , {field: 'title', title: '需求名称', align: 'center'}

                ]]
            });

        });
    </script>
</block>